package xyz.ddlnt.serviceusr.controller;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import xyz.ddlnt.commonutil.result.Result;
import xyz.ddlnt.model.dto.PageDTO;
import xyz.ddlnt.model.vo.PostRecordVO;
import xyz.ddlnt.serviceusr.service.PostHistoryRecordService;

import java.util.List;

/**
 * @author ZZULI_SE 210910
 * @data 2025/5/25 21:48
 */
@Slf4j
@RequestMapping("/post_history_record")
@RestController
public class PostHistoryRecordController {
    @Resource
    private PostHistoryRecordService postHistoryRecordService;

    /**
     * 获取帖子浏览历史
     * @param pageDTO
     * @return
     */
    @PostMapping("/getPostHistoryRecordList")
    public Result<List<PostRecordVO>> getPostHistoryRecordList(@RequestBody PageDTO pageDTO) {
        return Result.success(postHistoryRecordService.getPostHistoryRecordList(pageDTO));
    }

    /**
     * 删除帖子浏览历史
     * @param id
     * @return
     */
    @DeleteMapping("/removeById")
    Result<Boolean> removeById(@RequestParam Long id){
        return Result.success(postHistoryRecordService.removeById(id));
    }
}
